/**
 * 
 */
	var list1 = new Array;
    var list2 = new Array;
    list1[list1.length] ="-选择城市";
    list1[list1.length] = "北京市";
    list1[list1.length] = "上海市";
    list1[list1.length] = "杭州市";
    list1[list1.length] = "长沙市";
    list2[list2.length] = new Array("-选择机场");
    list2[list2.length] = new Array("北京首都机场","北京南苑机场");
    list2[list2.length] = new Array("上海虹桥机场","上海浦东机场");
    list2[list2.length] = new Array("杭州市萧山机场");
    list2[list2.length] = new Array("长沙黄花机场"); 
  	
  	var ddlProvince = document.getElementById("province");
    var ddlCity = document.getElementById("city");
    for(var i =0;i<list1.length; i++)
    {
        var option = document.createElement("option");
        option.appendChild(document.createTextNode(list1[i]));
        option.value = list1[i];
        ddlProvince.appendChild(option);
        //city initialize
        var firstprovince = list2[0];
        for (var j = 0; j < firstprovince.length; j++) {
            var optioncity = document.createElement("option");
            optioncity.appendChild(document.createTextNode(firstprovince[j]));
            optioncity.value = firstprovince[j];
            ddlCity.appendChild(optioncity);
        }
    }
    function indexof(obj,value)
    {
        var k=0;
        for(;k<obj.length;k++)
        {
            if(obj[k] == value)
            return k;
        }
        return k;
    }
    function selectprovince(obj) {
        ddlCity.options.length = 0;//clear
        var index = indexof(list1,obj.value);
        var list2element = list2[index];
        for(var i =0;i<list2element.length; i++)
        {
            var option = document.createElement("option");
            option.appendChild(document.createTextNode(list2element[i]));
            option.value = list2element[i];
            ddlCity.appendChild(option);
        }
    }